package javaapplication1;

public class Camera {

    // TO DO: declare vairables
    String brand;
    int fLength;
    boolean shutterPressed;
    // TO DO: Define the getter and setter methods

    String getbrand() {
        return brand;
    }

    void setBrand(String aBrand) {
        brand = aBrand;
    }

    int getfLength() {
        return fLength;
    }

    void setfLength(int num) {
        fLength = num;
    }

    boolean getshutterPressed() {
        return shutterPressed;
    }

    void setshutterPressed(boolean TrueOrFalse) {
        shutterPressed = TrueOrFalse;
    }

    /**
     * Test code
     * @param args Command-line parameters representing user input
     * for the tests.
     */
    public static void main(String[] args) {

        Camera exampleCamera = new Camera();

        /**
         * exampleCamera.setBrand("Cannon");
         * exampleCamera.setfLength(20);
         * exampleCamera.setshutterPressed(true);
         */
        
        Camera[] cameraArray = {
            new Camera(),
            new Camera(),
            new Camera()
        };

        int argOffset = 0;
        for (int i = 0; i < cameraArray.length; ++i) {
            //TO DO : to set values to the attributes
            cameraArray[i].setBrand(args[argOffset]);
            ++argOffset;
            cameraArray[i].setfLength(Integer.parseInt(args[argOffset]));
            ++argOffset;
            cameraArray[i].setshutterPressed(Boolean.parseBoolean(args[argOffset]));
            ++argOffset;
        }

        for (int i = 0; i < cameraArray.length; ++i) {
            // TO DO : to get values and print the required output
            Camera camera = cameraArray[i];
            System.out.println("Brand is: " + camera.getbrand()
                    + " Focal Length is: " + camera.getfLength()
                    + " Shutter Pressed: " + camera.getshutterPressed());
        }

        //TO DO: comparison test

        if (cameraArray[0].getbrand().equals(cameraArray[1].getbrand())) {
            System.out.println("Camera 0 and Camera 1 have same brand!!");
        } else {
            System.out.println("Camera 0 and Camera 1 have different brands...");
        }

        if (cameraArray[0].getbrand().equals(cameraArray[2].getbrand())) {
            System.out.println("Camera 0 and Camera 2 have same brand!!");
        } else {
            System.out.println("Camera 0 and Camera 2 have different brands...");
        }

        if (cameraArray[0].getbrand().equals(cameraArray[1].getbrand())) {
            System.out.println("Camera 1 and Camera 2 have same brand!!");
        } else {
            System.out.println("Camera 1 and Camera 2 have different brands...");
        }

    }
}
